package com.csxh.web.dao;

import java.io.Serializable;
import java.util.List;

public interface IDao<T> {

	
	//通过Query对象来查询一个实体
	public T queryOne(String hql,Object...params);
	//通过Query对象来查询多个实体
	public List<T> queryAll(String hql,Object...params);

	//查询实体的某个属性
	public <P> P queryPropertyOne(String proptyName, String condition,Object...params);
	public <P> List<P> queryPropertyAll(String proptyName, String condition,Object...params);
	public String getIdProperty();
	/*
	 * 获取与表记录对应的单个JaveBean（实体对象）
	 * condition="id=?"
	 * params=1
	 */
	public T findOneById(Serializable id);
	
	public T findOneByCondition(String condition,Object...params);
	/*
	 * 获取与表记录对应的所有的JaveBean（实体对象）
	 * condition="id=?"
	 * params=1
	 */	
	public List<T> findAll();
	public List<T> findAll(String orderBy);
	public List<T> findAllByCondition(String condition,Object...params);
	public List<T> findAllByCondition(String orderBy,String condition,Object...params);
	
	//包含分页的查询
	public long totalCount(); 
	public long totalCount(String condition,Object...params); 
	

	public boolean save(T bean);
	public boolean delete(Serializable... ids);
	public boolean deleteAll();
	public boolean update(T bean);
	
}
